<?php

namespace bc\model\knowledge;

use bc\ar\MActiveRecord;

class CategoryModel extends MActiveRecord
{
	
	public $autoId = 'cate_id';
	
	public static function tableName()
	{
		return '{{%knowledge_category}}';
	}
	
	
	
	/**
	 * 通过子分类的id获取到所有子分类信息
	 */
	public function getSubCateList( $cate_id )
	{
		$params = 'parent_id = (SELECT parent_id FROM ' . $this->getTableSchema()->name . ' WHERE cate_id = ' . (int)$cate_id . ')';
		$ar = $this->find()->select($this->columns)->where($params);
		return $ar->asArray()->all();
	}
        
}

